home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib6 / v_08_10 / 8n10094a < prev    next >
Encoding:
Text File  |  1995-11-01  |  429 b   |  19 lines

  1.  
  2. #include <stdio.h>
  3. main()
  4. {
  5. /* using the returned values in conditional statements */
  6. FILE *fp;
  7. char buff[181];
  8. int more_data;
  9.  
  10. if ((fp = fopen("MYFILE.DAT","r")) == NULL)
  11.         printf("file not found\n");
  12. else {
  13.         printf("file found\n\n");
  14.         /* loop and print until we reach the end of file */
  15.         while ((more_data = fgets(buff, 180, fp)) != NULL)
  16.                 printf(buff);
  17.         }
  18. }
  19.